<%--
  Created by IntelliJ IDEA.
  User: yang
  Date: 2017/7/1
  Time: 16:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>小工匠订单管理系统</title>

    <link href="<%=path%>/resources/css/style.css" rel="stylesheet">
    <link href="<%=path%>/resources/css/style-responsive.css" rel="stylesheet">

</head>

<body class="login-body">

<div class="container">

    <form class="form-signin" action="#">
        <div class="form-signin-heading text-center">
            <h1 class="sign-title">账户</h1>
            <img src="<%=path%>/resources/images/login-logo.png" alt=""/>
        </div>
        <div class="login-wrap">
            <input type="text" id="username" value="" class="form-control" placeholder="账户" autofocus>
            <input type="password" id="password" value="" class="form-control" placeholder="密码">

            <button class="btn btn-lg btn-login btn-block" id="login" type="button">
                <i class="fa fa-check"></i>
            </button>

            <div class="registration">
                <a class="" href="<%=path%>/admin/reg/register.do">
                    注册
                </a>
            </div>
            <label class="checkbox">
                <%--<input type="checkbox" value="remember-me"> Remember me--%>
                <span class="pull-right">
                    <a data-toggle="modal" href="#myModal"> 忘记密码?</a>

                </span>
            </label>

        </div>

        <!-- Modal -->
        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal" class="modal fade">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">忘记密码 ?</h4>
                    </div>
                    <div class="modal-body">
                        <p>输入你的手机号重置密码.</p>
                        <input type="text" name="phone" placeholder="手机号" autocomplete="off" class="form-control placeholder-no-fix">
                    </div>
                    <div class="modal-footer">
                        <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
                        <button class="btn btn-primary" type="button">提交</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- modal -->

    </form>

</div>



<!-- Placed js at the end of the document so the pages load faster -->

<!-- Placed js at the end of the document so the pages load faster -->
<script src="<%=path%>/resources/js/jquery-1.10.2.min.js"></script>
<script src="<%=path%>/resources/js/bootstrap.min.js"></script>
<script src="<%=path%>/resources/js/modernizr.min.js"></script>
<script src="<%=path%>/resources/js/jquery-confirm.js"></script>
<script src="<%=path%>/resources/js/common.js"></script>
<script>
    $(function(){
        $("#login").on('click',function(){
            $.ajax({
                url: "<%=path%>/admin/login/loginToMain.do",
                method: 'POST',
                dataType: 'json',
                data: {
                    username: $('#username').val(),
                    password: $('#password').val()
                },
                success: function(data){
                    if(data.code==200){
                        window.location.href = '<%=basePath %>admin/user/user_list.do';
                    }else{
                        alert(data.hint);
                    }

                }
            });

        })
    })
</script>
</body>
</html>

